//
// Created by 33145 on 2023/5/28.
//

#include <unistd.h>
#include "wakeup_fd_event.h"
#include "../common/log.h"

namespace rocket {

  WakeUpFdEvent::WakeUpFdEvent(int fd) : FdEvent(fd) {

  }

  void WakeUpFdEvent::wakeup() {
    char buf[8] = {'a'};
    int rt = write(getFd(), buf, 8);
    if (rt != 8) {
      LOG_ERROR("write to wakeup fd less than 8 bytes, fd[%d]", getFd());
    }
    LOG_DEBUG("success onRead 8 bytes");
  }

}
